import { defineStore } from 'pinia'
import { postTestBanDetailRequest } from '@/service/module/testbank/testbankdetail'

// interface IloginFace{
//     id: number,
//     title:string,
//     path: string,
//     name: string,
//     content:string,
// }

interface Itestbankdetaildemo {
  iid: number
  nid: number
  nickname: string
  question: string
  options: [
    {
      value: string
      label: string
      isCorrect: boolean
    },
  ]

  answer: string
  title: string

  paper: string
  image: string
  name: string
  content: string
}

export const useTestBankDetailStore = defineStore('testbankdetail', {
  state: () => ({
    testbankdetailDatas: [] as Itestbankdetaildemo[],

    total: 0,
    iid: 0,
  }),

  actions: {
    //行测技巧列表数据
    async testAdminBankDetailResultAction(detailparams: any) {
      const res = await postTestBanDetailRequest(detailparams)
      console.log(res, '数据')

      this.testbankdetailDatas = res.data.data.findTestAdminDetailData[0].questions
      console.log(this.testbankdetailDatas, '题库详情页的数据')
      // this.optionsData=res.data.data.findTestAdminDetailData[0].questions.options
    },
  },
  persist: true,
})
